package com.mjfeed.entity;

import java.io.Serializable;
import java.math.BigDecimal;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.apache.commons.lang3.StringUtils;
import org.springframework.web.multipart.MultipartFile;
/**
 * @description 首页图片
 * @author zhaominglei
 * @date 2015年4月25日
 */
@Entity
@Table(name="feed_index_image")
public class IndexImage extends OrderEntity implements Serializable {
	private static final long serialVersionUID = -4988369335363844334L;
	/** 标题 **/
	private String title;
	/** 原图片 **/
	private String source;
	/** 类型 0轮播图片 1产品分类 2大家都喜欢 3新品上架 4热销排行 **/
	private Integer type;
	/** 网址 **/
	private String url;
	/** 原价 */
    private BigDecimal price;
    /** 促销价 */
    private BigDecimal promotionPrice;
	/** 文件 */
	private MultipartFile file;
	
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getSource() {
		return source;
	}
	public void setSource(String source) {
		this.source = source;
	}
	public Integer getType() {
		return type;
	}
	public void setType(Integer type) {
		this.type = type;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public BigDecimal getPrice() {
		return price;
	}
	public void setPrice(BigDecimal price) {
		this.price = price;
	}
	@Column(name="promotion_price")
	public BigDecimal getPromotionPrice() {
		return promotionPrice;
	}
	public void setPromotionPrice(BigDecimal promotionPrice) {
		this.promotionPrice = promotionPrice;
	}
	
	@Transient
	public MultipartFile getFile() {
		return file;
	}
	public void setFile(MultipartFile file) {
		this.file = file;
	}
	/**
	 * 判断是否为空
	 * 
	 * @return 是否为空
	 */
	@Transient
	public boolean isEmpty() {
		return (getFile() == null || getFile().isEmpty()) && StringUtils.isEmpty(getSource());
	}
}
